package cz.semjobKB.virtuoso.document.impl;

import cz.semjobKB.virtuoso.document.api.IDocumentDetail;
import cz.semjobKB.virtuoso.document.api.ITerminologyDetail;
import cz.semjobKB.virtuoso.document.api.ITripleDbItem;

import java.util.List;

/**
 * Document detail retrieved from the database
 */
public class DocumentDetail implements IDocumentDetail {

	private final String documentName;
	private final String documentPath;
	private final String documentText;
	private final List<ITripleDbItem> triples;
	private final List<ITerminologyDetail> terminology;
	private final Integer sentenceCount;
	private final Integer uniqueTermCount;
	private final Integer uniquePredicateCount;
	private final Integer termCount;

    /**
     * Constructor
     * @param documentName              Original document name, file name
     * @param documentPath              Document file path on a disk
     * @param documentText              Original document converted into plain text
     * @param triples                   List of triples
     * @param terminology               List of terminologies
     * @param uniqueTermsCount          Number of unique terms, subjects and objects
     * @param uniquePredicateCount      Number of unique predicates
     * @param termCount                 Sum of terminologies frequencies
     * @param sentenceCount             Sentence count
     */
	public DocumentDetail(String documentName, String documentPath, String documentText, List<ITripleDbItem> triples, 
			List<ITerminologyDetail> terminology, Integer uniqueTermsCount, Integer uniquePredicateCount, 
			Integer termCount,	Integer sentenceCount) {
		this.documentName = documentName;
		this.documentPath = documentPath;
		this.documentText = documentText;
		this.triples = triples;
		this.terminology = terminology;
		this.sentenceCount = sentenceCount;
		this.uniqueTermCount = uniqueTermsCount;
		this.uniquePredicateCount = uniquePredicateCount;
		this.termCount = termCount;
	}
	
	
	public String getDocumentName() {		
		return documentName;
	}

	
	public String getDocumentPath() {		
		return documentPath;
	}

	
	public String getDocumentText() {		
		return documentText;
	}

	
	public List<ITripleDbItem> getTriples() {		
		return triples;
	}

	
	public List<ITerminologyDetail> getTerminology() {		
		return terminology;
	}

	
	public Integer getSentenceCount() {		
		return sentenceCount;
	}

	
	public Integer getTriplesCount() {
		if (triples != null) {
			return triples.size();
		}
		return 0;
	}

	
	public Integer getTerminologyCount() {		
		return termCount;
	}

	
	public Integer getUniqueTermCount() {		
		return uniqueTermCount;
	}

	
	public Integer getUniquePredicateCount() {
		return uniquePredicateCount;
	}

	
	public Integer getUniqueTerminologyCount() {
		if (terminology != null) {
			return terminology.size();
		}
		return 0;
	}

	
}
